package edu.xmut.kakamusic.utils;

import androidx.lifecycle.LiveData;


import java.util.List;
import java.util.Map;

import edu.xmut.kakamusic.bean.entity.Music;
import edu.xmut.kakamusic.bean.entity.News;
import edu.xmut.kakamusic.bean.entity.Python;
import edu.xmut.kakamusic.bean.entity.Video;
import edu.xmut.kakamusic.bean.form.MusicPlayForm;
import edu.xmut.kakamusic.bean.form.UserLoginForm;
import edu.xmut.kakamusic.bean.vo.HotSongVO;
import edu.xmut.kakamusic.bean.vo.RecommendVideoVO;
import edu.xmut.kakamusic.bean.vo.UserInfoVO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;

import com.github.leonardoxh.livedatacalladapter.Resource;

public interface API {
    @GET("/home_ad_list_data.json")
    LiveData<Resource<List<News>>> getAdList();

    @GET("/home_news_list_data.json")
    LiveData<Resource<List<News>>> getNewsList();

    @GET("/python_list_data.json")
    LiveData<Resource<List<Python>>> getPythonList();

    @GET("/video_list_data.json")
    LiveData<Resource<List<Video>>> getVideoList();

    @POST("/api/user/login/password")
    Call<ApiResponse<Map<String, String>>> loginByPassword(@Body UserLoginForm form);

    @POST("/api/user/login/code")
    Call<ApiResponse<Map<String, String>>> loginByCode(@Body UserLoginForm form);

    @GET("/api/user/code/send")
    Call<ApiResponse<Map<String, String>>> getCode(@Query("phone") String phone);


    @GET("/api/user/info")
    LiveData<Resource<ApiResponse<UserInfoVO>>> getUserInfo(@Header("Authorization") String token);

    @GET("/api/music/hot-song")
    LiveData<Resource<ApiResponse<List<HotSongVO>>>> getHotSong(@Header("Authorization") String token,
                                                                @Query("currentPage") Integer currentPage,
                                                                @Query("pageSize") Integer pageSize);

    @POST("/api/music/song/play")
    LiveData<Resource<ApiResponse<Music>>> getMusic(@Header("Authorization") String token,
                                                    @Body MusicPlayForm form);

    @POST("/api/music/song/play")
    Call<ApiResponse<Music>> getMusicCallable(@Header("Authorization") String token,
                                              @Body MusicPlayForm form);

    @POST("/api/video/recommend")
    Call<ApiResponse<List<RecommendVideoVO>>> getRecommendVideo(@Header("Authorization") String token,
                                                                @Query("timestamp") String timestamp);
}
